﻿// 项目：	Guan.CMS.CommandProcessor - Guan.CMS
// 文件名：	CommandResults.cs
// 
// 修改时间：2013-03-06 19:26
// 修改人：	Cooclsee

using System.Collections.Generic;
using System.Linq;

namespace Guan.CMS.CommandProcessor.Command
{
    public class CommandResults : ICommandResults
    {
        private readonly List<ICommandResult> _results = new List<ICommandResult>();

        public void AddResult(ICommandResult result)
        {
            this._results.Add(result);
        }

        public ICommandResult[] Results
        {
            get { return this._results.ToArray(); }
        }

        public bool Success
        {
            get { return this._results.All<ICommandResult>(result => result.Success); }
        }
    }
}